<script setup>
import { ref } from 'vue'
import { useGetArtInfoService } from '@/api/article'
//选择
const value = ref('')
const options = ref([])
const getArtInfoService = async () => {
  const {
    data: { data }
  } = await useGetArtInfoService()
  options.value = data
}

getArtInfoService()

//父传子
defineProps({
  modelValue: Number,
  width: String
})

const emit = defineEmits(['update:modelValue'])
</script>
<template>
  <el-form-item label="文章分类:">
    <el-select
      :modelValue="modelValue"
      @update:modelValue="emit('update:modelValue', $event)"
      placeholder="请选择"
      size="small"
      :style="{ width }"
    >
      <el-option
        v-for="item in options"
        :key="item.id"
        :label="item.cate_name"
        :value="item.id"
      />
    </el-select>
  </el-form-item>
</template>
